import com.violet.springaop.service.CalcService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootVersion;
import org.springframework.core.SpringVersion;

/**
 * @author LiChaochao
 * @Date 2021/10/21 11:09
 * @Description
 */
public class AOPText {
    @Autowired
    private CalcService calcService;

    /*
    * spring4测试
    * */
    @Test
    public void testSpring4() {
        System.out.println("spring版本：" + SpringVersion.getVersion());
        System.out.println("springboot版本：" + SpringBootVersion.getVersion());

        calcService.div(10, 2); // 正常
        calcService.div(10, 0); // 异常
    }

    /*
    * spring5测试
    * */
    @Test
    public void testSpring5() {
        System.out.println("spring版本：" + SpringVersion.getVersion());
        System.out.println("springboot版本：" + SpringBootVersion.getVersion());

        calcService.div(10, 2); // 正常
        calcService.div(10, 0); // 异常
    }
}
